

//
//  SelectRoleTableViewController.m
//  FlyGift
//
//  Created by lanou3g on 15/7/16.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "SelectRoleTableViewController.h"

@interface SelectRoleTableViewController ()
@property(nonatomic,strong)UILabel *jiaose;
@property(nonatomic,strong)NSArray *array;
@end

@implementation SelectRoleTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.title = @"选择角色";
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kP6Height(667-64)) style:UITableViewStyleGrouped];
    
    //取消cell与cell之间的横杠
    self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *dentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:dentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:dentifier];
    }
    
    _array = @[@"初中生",@"高中生",@"大学生",@"职场新人",@"资深工作党"];
    for (int i = 0; i<5; i++)
    {
        if (indexPath.row == i)
        {
            _jiaose = [[UILabel alloc]initWithFrame:CGRectMake(kP6width(200/2), 0, kP6width(80), kP6Height(44))];
            _jiaose.text = _array[i];
            _jiaose.font = [UIFont systemFontOfSize:14];
            _jiaose.textAlignment = NSTextAlignmentCenter;
            [cell addSubview:_jiaose];
            
            UILabel *l = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kP6Height(1))];
            l.backgroundColor = [UIColor blackColor];
            l.alpha = 0.1;
            [cell addSubview:l];
        }
    }
    return cell;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [[NSUserDefaults standardUserDefaults]setObject:_array[indexPath.row]forKey:@"role"];
    [self.navigationController popViewControllerAnimated:YES];
    
}


@end
